<?php

/**
 * 实名认证
 *
 * Created by PhpStorm.
 * User: evan
 * Date: 16/8/24
 * Time: 下午5:58
 */
class Realname_auth extends MY_Api_Controller
{
    public function auth()
    {
        $uid      = $this->uid;
        $realname = trim($this->input->get_post('realname'));
        $id_card  = trim($this->input->get_post('id_card'));


        $this->load->service('user/service_user_realname_auth');
        $data = $this->service_user_realname_auth->auth($uid, $realname, $id_card);


        $this->json_output($data['data'], $data['status']);
    }


    /**
     * 实名认证数据
     */
    public function info()
    {
        $uid   = $this->uid;


        $this->load->service('user/service_user_realname_auth');
        $data = $this->service_user_realname_auth->info($uid);


        $this->json_output($data['data'], $data['status']);
    }


    /**
     * 提交实名认证
     */
    public function submit()
    {
        $uid   = $this->uid;
        $param = array
        (
            'realname' => trim($this->input->get_post('realname')),
            'id_card'  => trim($this->input->get_post('id_card')),
            'positive' => trim($this->input->get_post('positive')),
            'hold'     => trim($this->input->get_post('hold')),
        );


        $this->load->service('user/service_user_realname_auth');
        $data = $this->service_user_realname_auth->submit($uid, $param);


        $this->json_output($data['data'], $data['status']);

    }


    /**
     * 审核
     */
    public function audit()
    {
        $uid       = $this->uid;
        $audit_uid = $this->uid;
        $status    = $this->uid;
        $opinion   = trim($this->input->get_post('opinion'));


        $this->load->service('user/service_user_realname_auth');
        $data = $this->service_user_realname_auth->audit($uid, $audit_uid, $status, $opinion);


        $this->json_output($data['data'], $data['status']);
    }
}